package 常用类.Date类;

public class Exercise1 {
    public static void main(String[] args) {
        //判断是否为回文串
        String str="absdef";
        if (isHuiWen(str)){
            System.out.println("是回文数");
        }else {
            System.out.println("不是回文数");
        }
//        if (str==null || str.length()==0){
//            return false;
//        }
//        StringBuffer stringBuffer = new StringBuffer(str);
//        String s = stringBuffer.reverse().toString();
//        return true;
    }
    public static boolean isHuiWen(String str){
        int left=0;
        int right=str.length()-1;
        while (left<right){
            if(str.charAt(left)!=str.charAt(right)){
                return false;
            }
            left++;
            right--;
        }
        return true;
    }
}
